var pool = require("./config/db.js")

function User(user) {
  this.name = user.name;
  this.password = user.password;
  this.email = user.email;
};

module.exports = User;

//存储用户信息(er)
User.prototype.save = function(callback) {
  //要存入数据库的用户文档
  var user = {
      name: this.name,
      password: this.password,
      email: this.email
  };
  //打开数据库
};

//读取用户信息
User.get = function(name, callback) {
  //打开数据库
    pool.getConnection(function(err,connection){
        connection.query('SELECT * FROM `users` ', function (err, rows, fields) {
            if (err) throw err;
            console.log('The solution is: ', rows[0]);
        });
    });
};